[toc]
centos7.8搭建openstack Mitaka版
mitaka版密码说明
密码名称 | 描述 |
---|---|
数据库密码(不能使用变量) | 数据库的root密码 |
ADMIN_PASS | admin 用户密码 |
CEILOMETER_DBPASS | Telemetry 服务的数据库密码 |
CEILOMETER_PASS | Telemetry 服务的 ceilometer 用户密码 |
CINDER_DBPASS | 块设备存储服务的数据库密码 |
CINDER_PASS | 块设备存储服务的 cinder 密码 |
DASH_DBPASS | Database password for the dashboard |
DEMO_PASS | demo 用户的密码 |
GLANCE_DBPASS | 镜像服务的数据库密码 |
GLANCE_PASS | 镜像服务的 glance 用户密码 |
HEAT_DBPASS | Orchestration服务的数据库密码 |
HEAT_DOMAIN_PASS | Orchestration 域的密码 |
HEAT_PASS | Orchestration 服务中heat 用户的密码 |
KEYSTONE_DBPASS | 认证服务的数据库密码 |
NEUTRON_DBPASS | 网络服务的数据库密码 |
NEUTRON_PASS | 网络服务的 neutron 用户密码 |
NOVA_DBPASS | 计算服务的数据库密码 |
NOVA_PASS | 计算服务中nova 用户的密码 |
RABBIT_PASS | RabbitMQ的guest用户密码 |
SWIFT_PASS | 对象存储服务用户swift 的密码 |
实验环境
角色 | IP | 主机名 | 默认网关 | 硬件环境 | 虚拟化 | 防火墙 | selinux |
---|---|---|---|---|---|---|---|
控制节点 | 10.0.0.11/24 | controller | 10.0.0.1 | 4G内存,50G硬盘 | 开启 | 关闭 | 关闭 |
计算节点 | 10.0.0.31/24 | compute1 | 10.0.0.1 | 4G内存,50G硬盘 | 开启 | 关闭 | 关闭 |
1.基础环境配置
1.1 关闭防火墙和selinux
//禁用防火墙
systemctl stop firewalld && systemctl disable firewalld
//禁用selinux
#临时修改
setenforce 0
#永久修改,重启服务器后生效
sed -i '7s/enforcing/disabled/' /etc/selinux/config
1.2 配置hosts解析
#控制节点和计算节点相同操作
cat >> /etc/hosts << EOF
10.0.0.11 controller
10.0.0.31 compute1
10.0.0.41 block1
10.0.0.51 object1
10.0.0.52 object2
EOF
1.3 配置NTP服务,要保证控制节点和计算节点时间一致
控制节点
1.安装chrony
yum -y install chrony
2.编辑chrony配置文件/etc/chrony.conf
/删除以下4行,使用阿里云NTP服务器
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
修改为
server ntp1.aliyun.com iburst
/允许连接控制节点的网段,24行增加以下一行
allow 10.0.0.0/24
#用以下命令修改
sed -i '3,6d' /etc/chrony.conf && sed -i '3cserver ntp1.aliyun.com iburst' \
/etc/chrony.conf && sed -i '23callow 10.0.0.0/24' /etc/chrony.conf
3.启动NTP服务并设置开机自启
systemctl enable chronyd && systemctl start chronyd
4.检查端口,监听udp323端口
netstat -nupl|grep chronyd
udp 0 0 127.0.0.1:323 0.0.0.0:* 29356/chronyd
udp 0 0 0.0.0.0:123 0.0.0.0:* 29356/chronyd
udp6 0 0 ::1:323 :::* 29356/chronyd
5.验证
chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* 8.8.8.8 2 6 37 29 +43us[ -830us] +/- 22ms
计算节点
1.安装chrony
yum -y install chrony
2.编辑chrony配置文件/etc/chrony.conf
/删除以下4行,指定控制节点为NTP服务器
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
修改为
server controller iburst
#用以下命令修改
sed -i '3,6d' /etc/chrony.conf && sed -i '3cserver controller iburst' /etc/chrony.conf
3.启动NTP服务并设置开机自启
systemctl enable chronyd && systemctl start chronyd
4.检查端口,监听udp323端口
netstat -nupl|grep chronyd
udp 0 0 127.0.0.1:323 0.0.0.0:* 1327/chronyd
udp6 0 0 ::1:323 :::* 1327/chronyd
5.验证,计算节点显示的是控制节点
chronyc sources
210 Number of sources = 1
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? controller 3 6 200 50 +1319ms[+1319ms] +/- 14.4s
1.4 下载openstack官方yum源安装openstack客户端
⚠️Mitaka版官方 文档中直接安装centos-release-openstack-mitaka
会提示没有可用包(使用的是阿里云的yum源),得先下载一个包才可以继续安装!!!
下载官方yum源提示无包可用解决方法
控制节点和计算节点相同操作
#下载yum源并安装openstack客户端
wget https://cbs.centos.org/kojifiles/packages/centos-release-openstack-mitaka/1/1.el7/noarch/centos-release-openstack-mitaka-1-1.el7.noarch.rpm
yum -y localinstall centos-release-openstack-mitaka-1-1.el7.noarch.rpm
yum -y install python-openstackclient
到此,控制节点和计算节点操作完成!!!
2.控制节点环境安装
2.1 安装mariadb数据库
1.安装mariadb数据库
yum -y install mariadb mariadb-server python2-PyMySQL
2.创建并编辑 /etc/my.cnf.d/openstack.cnf
在[mysqld]中,设置“bind-address”值为控制节点的管理网络IP地址以使得其他节点可以通过管理网络访问访问数据库。设置其他关键字来设置一些有用的选项和UTF-8编码
cat > /etc/my.cnf.d/openstack.cnf << EOF
[mysqld]
bind-address = 10.0.0.11
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
EOF
3.启动数据库并设置开机自启
systemctl enable mariadb && systemctl start mariadb
4.进行数据库安全设置
mysql_secure_installation
Enter current password for root (enter for none): /没有密码,直接回车
Set root password? [Y/n] n /不设置root密码
Remove anonymous users? [Y/n] y /移除匿名用户
Disallow root login remotely? [Y/n] y /禁止root远程登陆
Remove test database and access to it? [Y/n] y /移除test数据库
Reload privilege tables now? [Y/n] y /刷新权限表